package com.seventh.restaurant.repository;


import com.seventh.restaurant.domain.Table;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@SuppressWarnings("unused")
@Repository
public interface TableRepository extends JpaRepository<Table,Long> {

    Table findByTableNo(String tableNo);

    @Query("SELECT a FROM Table a WHERE a.size=?1 AND a.isRecord='0' AND a.isBusy='0' ORDER BY a.id ASC")
    List<Table> findTablesByPeopleNum(String peoplenum);

    @Query("SELECT a FROM Table a WHERE  a.isRecord='0' AND a.isBusy='0' ORDER BY a.id ASC")
    List<Table> findValidTables();

}
